﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="GestionRoles.aspx.cs" Inherits="API_CIC.UsuariosRoles.GestionRoles" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style1
        {
            width: 83px;
        }
        .style2
        {
            height: 21px;
            text-align: left;
        }
        .style4
        {
            height: 21px;
            width: 241px;
        }
        .style5
        {
            width: 310px;
        }
        .style6
        {
            width: 374px;
        }
        .style7
        {
            width: 310px;
            height: 49px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <table style="width:100%;">
        <tr>
            <td class="leftCol" valign="top">
                <asp:Menu ID="Menu1" runat="server" BackColor="#B5C7DE" 
                    DynamicHorizontalOffset="2" Font-Names="Verdana" Font-Size="0.8em" 
                    ForeColor="#284E98" StaticSubMenuIndent="10px" 
                    onmenuitemclick="Menu1_MenuItemClick">
                    <DynamicHoverStyle BackColor="#284E98" ForeColor="White" />
                    <DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
                    <DynamicMenuStyle BackColor="#B5C7DE" />
                    <DynamicSelectedStyle BackColor="#507CD1" />
                    <Items>
                        <asp:MenuItem Text="Consultar Rol" Value="1" Selected="True"></asp:MenuItem>
                        <asp:MenuItem Text="Ingresar Rol" Value="0"></asp:MenuItem>
                    </Items>
                    <StaticHoverStyle BackColor="#284E98" ForeColor="White" />
                    <StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
                    <StaticSelectedStyle BackColor="#507CD1" />
                </asp:Menu>
            </td>
            <td>
                <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="1">
                    <asp:View ID="ViewIngresar" runat="server" EnableTheming="True">
                    <center><h3>Ingresar Nuevo Rol</h3>
                        <p>
                            &nbsp;</p>
                        </center>
                        <table style="width:100%;" border="Blue">
                            <tr>
                                <td class="style4">
                                    <table style="width:99%;">
                                        <tr>
                                            <td class="style7">
                                                Nombre: <asp:TextBox ID="txtNombre" runat="server" Width="157px"></asp:TextBox>
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" 
                                                    ControlToValidate="txtNombre" ErrorMessage="Campo Requerido " ForeColor="Red" 
                                                    ValidationGroup="1">*</asp:RequiredFieldValidator>
                                                <br />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="style5">
                                                Descripción:<br /> &nbsp;<asp:TextBox ID="txtDescripcion" runat="server" 
                                                    Height="56px" TextMode="MultiLine" Width="205px"></asp:TextBox></td>
                                        </tr>
                                    </table>
                                    </td> 
                                <td class="style2">
                                    Seleccione los permisos del nuevo rol:
                                    <br />
                                    <br />
                                    <asp:CheckBoxList ID="cblPermisos" runat="server" 
                                        DataSourceID="LinqDataSource1" DataTextField="NOM_PERMISO" 
                                        DataValueField="ID_PERMISO" style="text-align: left">
                                    </asp:CheckBoxList>
                                    <asp:LinqDataSource ID="LinqDataSource1" runat="server" 
                                        ContextTypeName="API_CIC.LinqClasesDataContext" EntityTypeName="" 
                                        TableName="SGAPFPERMISOs">
                                    </asp:LinqDataSource>
                                    </td>
                            </tr>
                            
                        </table>
                        <center>
                            <asp:Button ID="btnIngresar" runat="server" Text="Ingresar" 
                                onclick="btnIngresar_Click" ValidationGroup="1" /></center>
                        
                    </asp:View>
                    <asp:View ID="ViewConsultar" runat="server">
                    <center><h3>Consultar Rol</h3>
                        <p>
                            &nbsp;</p>
                        </center>
                        <table style="width:100%;">
                            <tr>
                                <td class="style6">
                                    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                                        DataKeyNames="ID_ROL" DataSourceID="LinqDataSource2" CellPadding="4" 
                                        ForeColor="#333333" GridLines="None" onrowediting="GridView1_RowEditing" 
                                        onselectedindexchanged="GridView1_SelectedIndexChanged">
                                        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                                        <Columns>
                                            <asp:CommandField ShowSelectButton="True" ButtonType="Image" EditText="Editar" 
                                                SelectImageUrl="~/images/arrow_right_pagging.gif" />
                                            <asp:BoundField DataField="ID_ROL" HeaderText="Id Rol" ReadOnly="True" 
                                                SortExpression="ID_ROL" />
                                            <asp:BoundField DataField="NOM_ROL" HeaderText="Nombre" 
                                                SortExpression="NOM_ROL" />
                                            <asp:BoundField DataField="DSC_ROL" HeaderText="Descripción" 
                                                SortExpression="DSC_ROL" />
                                            <asp:CommandField ShowEditButton="True" EditText="Editar" />
                                            <asp:TemplateField ShowHeader="False">
                                    <ItemTemplate>
                                        <asp:LinkButton ID="Elimina" runat="server" CausesValidation="False" 
                                            CommandName="Delete" 
                                            OnClientClick="return confirm(&quot;¿Desea eliminar este rol?&quot;);" 
                                            Text="Eliminar" />
                                    </ItemTemplate>
                                    <ControlStyle ForeColor="#CC0000" />
                                </asp:TemplateField>
                                        </Columns>
                                        <EditRowStyle BackColor="#999999" />
                                        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                        <SortedAscendingCellStyle BackColor="#E9E7E2" />
                                        <SortedAscendingHeaderStyle BackColor="#506C8C" />
                                        <SortedDescendingCellStyle BackColor="#FFFDF8" />
                                        <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                                    </asp:GridView>
                                    <asp:LinqDataSource ID="LinqDataSource2" runat="server" 
                                        ContextTypeName="API_CIC.LinqClasesDataContext" EntityTypeName="" 
                                        TableName="SGAPFROLEs" EnableDelete="True" EnableUpdate="True">
                                    </asp:LinqDataSource>
                                </td>
                                    <td>
                                        Edite los permisos correspondientes<asp:CheckBoxList ID="cblPermisosModificar" 
                                            runat="server" DataSourceID="LinqDataSource1" DataTextField="NOM_PERMISO" 
                                            DataValueField="ID_PERMISO">
                                        </asp:CheckBoxList>
                                        <br />
                                        <asp:Button ID="btnGuardar" runat="server" Text="Guardar" 
                                            onclick="btnGuardar_Click" />
                                </td>
                            </tr>
                        </table>
                    </asp:View>
                </asp:MultiView>
            </td>
        </tr>
     
    </table>
</asp:Content>
